package com.example.demo.test;

import org.assertj.core.api.Assertions;
import org.junit.Assert;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Readme {

    // junit 4  方法必须使用public修饰 否则报错
    @org.junit.Test
    public void pp(){

        // junit 4 提供的断言
        Assert.assertFalse(false);
        Assert.assertEquals(1,1);
        Assert.assertEquals("aa","aa");
//        Assert.assertThrows(Exception.class,()->{});
        Assert.assertNotNull(new ArrayList<>());

    }

    // junit 5
    @org.junit.jupiter.api.Test
    void p(){
        // junit 5 提供的断言
        org.junit.jupiter.api.Assertions.assertFalse(false);
        org.junit.jupiter.api.Assertions.assertEquals(1,1);
        org.junit.jupiter.api.Assertions.assertEquals("aa","aa");
//        org.junit.jupiter.api.Assertions.assertThrows(Exception.class,()->{});
    }

    @Test
    public void tt(){
        // 断言神器
        // https://blog.csdn.net/qq_36838191/article/details/81299079
        Assertions.assertThat(1).as("断言1等于1").isEqualTo(1);
        Assertions.assertThat("aa").isEqualTo("aa").contains("a");
        Assertions.assertThat("aa").as("测试aa等于a").isEqualTo("a");
        Assertions.assertThat(new Object()).isNotNull();
//        Assertions.assertThatThrownBy(()->{}).hasMessageContaining("错误信息");
        Assertions.assertThat(Collections.singleton("a")).hasSize(1);

        List list = new ArrayList();
        Assertions.assertThat(list).isIn(new ArrayList(), new HashMap());
    }



    @Test
    void pattern01() {
        String str = "1.6";
        // 1-9  至少0个数字  .
        Pattern pattern = Pattern.compile("([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])");
        Matcher matcher = pattern.matcher(str);
        org.junit.jupiter.api.Assertions.assertTrue(matcher.find());
    }

    @Test
    void pattern02() {
        String str = "1.";
        // 1-9  至少0个数字  .
        Pattern pattern = Pattern.compile("([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])");
        Matcher matcher = pattern.matcher(str);
        org.junit.jupiter.api.Assertions.assertTrue(matcher.find());
    }
    @Test
    void pattern03() {
        String str = "0.89";
        // 1-9  至少0个数字  .
        Pattern pattern = Pattern.compile("([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])");
        Matcher matcher = pattern.matcher(str);
        org.junit.jupiter.api.Assertions.assertTrue(matcher.find());
    }

    @Test
    void pattern04() {
        String str = "1.";
        // 1-9  至少0个数字  .
        Pattern pattern = Pattern.compile("([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])");
        Matcher matcher = pattern.matcher(str);
        org.junit.jupiter.api.Assertions.assertTrue(matcher.find());
    }

    @Test
    void sort(){
        int[] array = {9,4,6,2,8,5,7,1};
        Arrays.sort(array);
        System.out.println("array:");
        for (int i : array) {
            System.out.println(i);
        }
        HashMap<Object, Object> objectObjectHashMap = new HashMap<>();

        Integer integer = null;
        Integer a = true ? integer : 0;
        // 16/2

    }

    @Test
    void kk(){
        HashMap<String, Integer> map = new HashMap<>(8);

        int u = map.get("A") / 6;
    }

    @Test
    void sout(){
        HashMap<String, String> clickMap = new HashMap<>(256);
        HashMap<String, String> waitTransportedMap = new HashMap<>(256);

        clickMap.put("A20220228000005","2022-03-08 15:41:14");
        clickMap.put("A20220228000006","2022-03-08 16:10:44");
        clickMap.put("A20220303000022","2022-03-09 10:03:20");
        clickMap.put("A20220303000022","2022-03-09 10:03:20");
        clickMap.put("A20220303000023","2022-03-09 10:03:20");
        clickMap.put("A20220303000023","2022-03-09 10:03:20");
        clickMap.put("A20220304000008","2022-03-09 10:19:43");
        clickMap.put("A20220304000008","2022-03-09 10:19:43");
        clickMap.put("A20220304000012","2022-03-09 11:19:05");
        clickMap.put("A20220304000012","2022-03-09 11:19:04");
        clickMap.put("A20220305000007","2022-03-08 09:21:26");
        clickMap.put("A20220305000008","2022-03-08 09:21:26");
        clickMap.put("A20220305000009","2022-03-08 10:47:52");
        clickMap.put("A20220305000010","2022-03-08 11:20:30");
        clickMap.put("A20220305000011","2022-03-08 11:20:30");
        clickMap.put("A20220307000001","2022-03-08 09:59:48");
        clickMap.put("A20220307000002","2022-03-08 09:59:48");
        clickMap.put("A20220307000003","2022-03-09 15:42:30");
        clickMap.put("A20220307000004","2022-03-08 09:59:48");
        clickMap.put("A20220307000005","2022-03-08 09:59:48");
        clickMap.put("A20220307000006","2022-03-08 10:23:25");
        clickMap.put("A20220307000007","2022-03-08 14:06:38");
        clickMap.put("A20220307000012","2022-03-08 11:20:00");
        clickMap.put("A20220307000013","2022-03-08 10:04:10");
        clickMap.put("A20220307000014","2022-03-08 09:59:48");
        clickMap.put("A20220307000015","2022-03-08 10:23:25");
        clickMap.put("A20220307000021","2022-03-08 13:17:39");
        clickMap.put("A20220307000022","2022-03-08 14:37:44");
        clickMap.put("A20220307000023","2022-03-08 14:06:38");
        clickMap.put("A20220307000024","2022-03-08 11:20:00");
        clickMap.put("A20220307000025","2022-03-08 11:48:10");
        clickMap.put("A20220307000027","2022-03-08 14:37:44");
        clickMap.put("A20220307000029","2022-03-08 10:41:50");
        clickMap.put("A20220307000030","2022-03-08 10:23:25");
        clickMap.put("A20220307000031","2022-03-08 10:23:25");
        clickMap.put("A20220307000032","2022-03-08 09:59:47");
        clickMap.put("A20220307000034","2022-03-08 14:17:00");
        clickMap.put("A20220307000035","2022-03-08 10:23:25");
        clickMap.put("A20220307000036","2022-03-08 14:37:44");
        clickMap.put("A20220307000038","2022-03-08 14:17:00");
        clickMap.put("A20220307000039","2022-03-08 15:55:09");
        clickMap.put("A20220307000040","2022-03-09 09:50:04");
        clickMap.put("A20220307000041","2022-03-08 11:20:00");
        clickMap.put("A20220307000042","2022-03-08 13:17:39");
        clickMap.put("A20220307000043","2022-03-08 18:04:30");
        clickMap.put("A20220307000044","2022-03-09 11:46:40");
        clickMap.put("A20220307000045","2022-03-08 11:20:00");
        clickMap.put("A20220307000046","2022-03-08 13:18:09");
        clickMap.put("A20220307000047","2022-03-08 14:06:38");
        clickMap.put("A20220307000048","2022-03-09 10:53:49");
        clickMap.put("A20220307000049","2022-03-08 11:48:09");
        clickMap.put("A20220307000050","2022-03-08 13:17:39");
        clickMap.put("A20220307000051","2022-03-08 14:06:38");
        clickMap.put("A20220307000052","2022-03-09 10:17:01");
        clickMap.put("A20220307000053","2022-03-08 11:20:00");
        clickMap.put("A20220307000054","2022-03-08 15:41:00");
        clickMap.put("A20220307000056","2022-03-09 11:46:40");
        clickMap.put("A20220307000057","2022-03-09 09:28:04");
        clickMap.put("A20220308000001","2022-03-09 13:35:32");
        clickMap.put("A20220308000004","2022-03-09 17:01:24");
        clickMap.put("A20220308000005","2022-03-09 14:44:31");
        clickMap.put("A20220308000006","2022-03-09 17:01:24");
        clickMap.put("A20220308000007","2022-03-09 15:42:30");
        clickMap.put("A20220308000008","2022-03-08 14:37:44");
        clickMap.put("A20220308000009","2022-03-08 11:20:00");
        clickMap.put("A20220308000010","2022-03-09 10:32:26");
        clickMap.put("A20220308000011","2022-03-08 14:37:43");
        clickMap.put("A20220308000012","2022-03-08 16:15:14");
        clickMap.put("A20220308000016","2022-03-09 09:28:04");
        clickMap.put("A20220308000018","2022-03-09 09:59:34");
        clickMap.put("A20220308000019","2022-03-09 10:53:49");
        clickMap.put("A20220308000021","2022-03-09 13:32:07");
        clickMap.put("A20220308000022","2022-03-09 09:28:03");
        clickMap.put("A20220308000024","2022-03-09 13:32:07");
        clickMap.put("A20220308000026","2022-03-09 14:31:16");
        clickMap.put("A20220308000027","2022-03-08 14:37:43");
        clickMap.put("A20220308000028","2022-03-08 14:37:43");
        clickMap.put("A20220308000030","2022-03-08 16:15:14");
        clickMap.put("A20220308000031","2022-03-09 16:45:44");
        clickMap.put("A20220308000032","2022-03-09 14:31:16");
        clickMap.put("A20220308000034","2022-03-09 09:28:03");
        clickMap.put("A20220308000035","2022-03-08 16:15:14");
        clickMap.put("A20220308000036","2022-03-08 16:15:14");
        clickMap.put("A20220308000037","2022-03-09 19:38:07");
        clickMap.put("A20220308000038","2022-03-09 11:40:51");
        clickMap.put("A20220308000039","2022-03-09 09:41:19");
        clickMap.put("A20220308000040","2022-03-09 15:06:33");
        clickMap.put("A20220308000041","2022-03-09 17:20:28");
        clickMap.put("A20220308000042","2022-03-09 17:17:48");
        clickMap.put("A20220308000043","2022-03-09 15:42:30");
        clickMap.put("A20220308000044","2022-03-08 16:15:14");
        clickMap.put("A20220308000045","2022-03-09 09:50:04");
        clickMap.put("A20220308000046","2022-03-09 09:59:34");
        clickMap.put("A20220308000047","2022-03-09 14:00:38");
        clickMap.put("A20220308000048","2022-03-09 09:28:03");
        clickMap.put("A20220308000049","2022-03-09 09:28:03");
        clickMap.put("A20220308000050","2022-03-09 19:38:07");
        clickMap.put("A20220308000051","2022-03-09 11:10:41");
        clickMap.put("A20220308000053","2022-03-08 16:15:14");
        clickMap.put("A20220308000054","2022-03-09 09:28:03");
        clickMap.put("A20220308000055","2022-03-09 09:28:03");
        clickMap.put("A20220308000056","2022-03-09 10:17:01");
        clickMap.put("A20220308000059","2022-03-09 09:28:03");
        clickMap.put("A20220308000062","2022-03-09 09:59:50");
        clickMap.put("A20220308000063","2022-03-09 14:00:42");
        clickMap.put("A20220308000064","2022-03-09 17:17:48");
        clickMap.put("A20220308000065","2022-03-09 17:01:24");
        clickMap.put("A20220308000068","2022-03-09 14:00:38");
        clickMap.put("A20220308000069","2022-03-09 11:10:41");
        clickMap.put("A20220308000071","2022-03-09 13:35:32");
        clickMap.put("A20220308000073","2022-03-09 13:35:32");
        clickMap.put("A20220308000074","2022-03-09 13:36:11");
        clickMap.put("A20220308000075","2022-03-09 15:06:33");
        clickMap.put("A20220308000076","2022-03-09 14:44:44");
        clickMap.put("A20220308000078","2022-03-09 14:31:16");
        clickMap.put("A20220308000079","2022-03-09 15:06:33");
        clickMap.put("A20220308000080","2022-03-09 11:10:41");
        clickMap.put("A20220308000081","2022-03-09 11:40:53");
        clickMap.put("A20220308000083","2022-03-09 17:01:24");
        clickMap.put("A20220308000084","2022-03-09 16:15:45");
        clickMap.put("A20220308000085","2022-03-09 16:15:45");
        clickMap.put("A20220308000086","2022-03-09 16:14:51");
        clickMap.put("A20220308000087","2022-03-09 16:48:37");
        clickMap.put("A20220308000088","2022-03-09 14:31:15");
        clickMap.put("A20220309000003","2022-03-09 17:40:41");
        clickMap.put("A20220309000004","2022-03-09 17:17:48");
        clickMap.put("A20220309000005","2022-03-09 17:36:29");
        clickMap.put("A20220309000006","2022-03-09 17:40:41");

        waitTransportedMap.put("A20220305000008","2022-03-08 09:22:16");
        waitTransportedMap.put("A20220305000007","2022-03-08 09:22:29");
        waitTransportedMap.put("A20220307000032","2022-03-08 10:00:18");
        waitTransportedMap.put("A20220307000014","2022-03-08 10:00:21");
        waitTransportedMap.put("A20220307000005","2022-03-08 10:00:32");
        waitTransportedMap.put("A20220307000004","2022-03-08 10:00:33");
        waitTransportedMap.put("A20220307000002","2022-03-08 10:00:41");
        waitTransportedMap.put("A20220307000001","2022-03-08 10:00:46");
        waitTransportedMap.put("A20220307000013","2022-03-08 10:05:19");
        waitTransportedMap.put("A20220307000035","2022-03-08 10:24:13");
        waitTransportedMap.put("A20220307000031","2022-03-08 10:24:19");
        waitTransportedMap.put("A20220307000030","2022-03-08 10:24:20");
        waitTransportedMap.put("A20220307000015","2022-03-08 10:24:24");
        waitTransportedMap.put("A20220307000006","2022-03-08 10:24:25");
        waitTransportedMap.put("A20220307000029","2022-03-08 10:42:06");
        waitTransportedMap.put("A20220305000009","2022-03-08 10:48:19");
        waitTransportedMap.put("A20220308000009","2022-03-08 11:20:11");
        waitTransportedMap.put("A20220307000053","2022-03-08 11:20:14");
        waitTransportedMap.put("A20220307000045","2022-03-08 11:20:18");
        waitTransportedMap.put("A20220307000041","2022-03-08 11:20:23");
        waitTransportedMap.put("A20220307000024","2022-03-08 11:20:24");
        waitTransportedMap.put("A20220307000012","2022-03-08 11:20:27");
        waitTransportedMap.put("A20220305000011","2022-03-08 11:21:14");
        waitTransportedMap.put("A20220305000010","2022-03-08 11:21:19");
        waitTransportedMap.put("A20220307000049","2022-03-08 11:48:18");
        waitTransportedMap.put("A20220307000025","2022-03-08 11:48:25");
        waitTransportedMap.put("A20220307000050","2022-03-08 13:18:12");
        waitTransportedMap.put("A20220307000042","2022-03-08 13:18:16");
        waitTransportedMap.put("A20220307000021","2022-03-08 13:18:26");
        waitTransportedMap.put("A20220307000046","2022-03-08 13:19:16");
        waitTransportedMap.put("A20220307000051","2022-03-08 14:07:17");
        waitTransportedMap.put("A20220307000047","2022-03-08 14:07:20");
        waitTransportedMap.put("A20220307000023","2022-03-08 14:07:27");
        waitTransportedMap.put("A20220307000007","2022-03-08 14:07:30");
        waitTransportedMap.put("A20220307000038","2022-03-08 14:17:19");
        waitTransportedMap.put("A20220307000034","2022-03-08 14:17:39");
        waitTransportedMap.put("A20220308000028","2022-03-08 14:38:13");
        waitTransportedMap.put("A20220308000027","2022-03-08 14:38:15");
        waitTransportedMap.put("A20220308000011","2022-03-08 14:38:30");
        waitTransportedMap.put("A20220308000008","2022-03-08 14:38:40");
        waitTransportedMap.put("A20220307000036","2022-03-08 14:38:42");
        waitTransportedMap.put("A20220307000027","2022-03-08 14:38:44");
        waitTransportedMap.put("A20220307000022","2022-03-08 14:38:53");
        waitTransportedMap.put("A20220307000054","2022-03-08 15:41:23");
        waitTransportedMap.put("A20220228000005","2022-03-08 15:42:33");
        waitTransportedMap.put("A20220307000039","2022-03-08 15:56:22");
        waitTransportedMap.put("A20220228000006","2022-03-08 16:11:28");
        waitTransportedMap.put("A20220308000053","2022-03-08 16:16:06");
        waitTransportedMap.put("A20220308000044","2022-03-08 16:16:13");
        waitTransportedMap.put("A20220308000036","2022-03-08 16:16:24");
        waitTransportedMap.put("A20220308000035","2022-03-08 16:16:34");
        waitTransportedMap.put("A20220308000030","2022-03-08 16:16:39");
        waitTransportedMap.put("A20220308000012","2022-03-08 16:16:51");
        waitTransportedMap.put("A20220307000043","2022-03-08 18:05:15");
        waitTransportedMap.put("A20220307000052","2022-03-09 12:18:22");
        waitTransportedMap.put("A20220308000059","2022-03-09 12:18:24");
        waitTransportedMap.put("A20220304000008","2022-03-09 12:18:25");
        waitTransportedMap.put("A20220308000055","2022-03-09 12:18:29");
        waitTransportedMap.put("A20220308000010","2022-03-09 12:18:39");
        waitTransportedMap.put("A20220308000054","2022-03-09 12:18:41");
        waitTransportedMap.put("A20220308000019","2022-03-09 12:18:51");
        waitTransportedMap.put("A20220308000049","2022-03-09 12:18:52");
        waitTransportedMap.put("A20220308000048","2022-03-09 12:18:59");
        waitTransportedMap.put("A20220308000034","2022-03-09 12:19:00");
        waitTransportedMap.put("A20220308000022","2022-03-09 12:19:11");
        waitTransportedMap.put("A20220307000048","2022-03-09 12:19:17");
        waitTransportedMap.put("A20220308000080","2022-03-09 12:19:21");
        waitTransportedMap.put("A20220308000016","2022-03-09 12:19:22");
        waitTransportedMap.put("A20220307000057","2022-03-09 12:19:32");
        waitTransportedMap.put("A20220308000069","2022-03-09 12:19:32");
        waitTransportedMap.put("A20220308000039","2022-03-09 12:19:37");
        waitTransportedMap.put("A20220308000051","2022-03-09 12:19:38");
        waitTransportedMap.put("A20220304000012","2022-03-09 12:19:41");
        waitTransportedMap.put("A20220308000038","2022-03-09 12:19:47");
        waitTransportedMap.put("A20220308000045","2022-03-09 12:19:47");
        waitTransportedMap.put("A20220308000081","2022-03-09 12:19:51");
        waitTransportedMap.put("A20220307000040","2022-03-09 12:19:53");
        waitTransportedMap.put("A20220308000046","2022-03-09 12:19:58");
        waitTransportedMap.put("A20220308000018","2022-03-09 12:19:59");
        waitTransportedMap.put("A20220303000023","2022-03-09 12:20:08");
        waitTransportedMap.put("A20220308000062","2022-03-09 12:20:12");
        waitTransportedMap.put("A20220303000022","2022-03-09 12:20:13");
        waitTransportedMap.put("A20220308000056","2022-03-09 12:20:24");
        waitTransportedMap.put("A20220307000056","2022-03-09 12:20:37");
        waitTransportedMap.put("A20220307000044","2022-03-09 12:20:53");
        waitTransportedMap.put("A20220308000024","2022-03-09 13:33:19");
        waitTransportedMap.put("A20220308000021","2022-03-09 13:33:26");
        waitTransportedMap.put("A20220308000073","2022-03-09 13:36:10");
        waitTransportedMap.put("A20220308000071","2022-03-09 13:36:12");
        waitTransportedMap.put("A20220308000001","2022-03-09 13:36:14");
        waitTransportedMap.put("A20220308000074","2022-03-09 13:37:13");
        waitTransportedMap.put("A20220308000068","2022-03-09 14:01:17");
        waitTransportedMap.put("A20220308000047","2022-03-09 14:01:31");
        waitTransportedMap.put("A20220308000063","2022-03-09 14:01:46");
        waitTransportedMap.put("A20220308000088","2022-03-09 14:32:12");
        waitTransportedMap.put("A20220308000078","2022-03-09 14:32:20");
        waitTransportedMap.put("A20220308000032","2022-03-09 14:33:11");
        waitTransportedMap.put("A20220308000026","2022-03-09 14:33:13");
        waitTransportedMap.put("A20220308000005","2022-03-09 14:45:32");
        waitTransportedMap.put("A20220308000076","2022-03-09 14:45:49");
        waitTransportedMap.put("A20220308000079","2022-03-09 15:07:32");
        waitTransportedMap.put("A20220308000075","2022-03-09 15:07:41");
        waitTransportedMap.put("A20220308000040","2022-03-09 15:07:48");
        waitTransportedMap.put("A20220308000043","2022-03-09 15:43:37");
        waitTransportedMap.put("A20220308000007","2022-03-09 15:44:00");
        waitTransportedMap.put("A20220307000003","2022-03-09 15:44:09");
        waitTransportedMap.put("A20220308000086","2022-03-09 16:15:29");
        waitTransportedMap.put("A20220308000085","2022-03-09 16:16:32");
        waitTransportedMap.put("A20220308000084","2022-03-09 16:16:46");
        waitTransportedMap.put("A20220308000031","2022-03-09 16:47:10");
        waitTransportedMap.put("A20220308000087","2022-03-09 16:49:21");
        waitTransportedMap.put("A20220308000083","2022-03-09 17:02:16");
        waitTransportedMap.put("A20220308000065","2022-03-09 17:02:42");
        waitTransportedMap.put("A20220308000006","2022-03-09 17:02:48");
        waitTransportedMap.put("A20220308000004","2022-03-09 17:03:05");
        waitTransportedMap.put("A20220309000004","2022-03-09 17:18:20");
        waitTransportedMap.put("A20220308000064","2022-03-09 17:18:27");
        waitTransportedMap.put("A20220308000042","2022-03-09 17:18:49");
        waitTransportedMap.put("A20220308000041","2022-03-09 17:21:21");
        waitTransportedMap.put("A20220309000005","2022-03-09 17:37:14");
        waitTransportedMap.put("A20220309000006","2022-03-09 17:41:13");
        waitTransportedMap.put("A20220309000003","2022-03-09 17:41:25");
        waitTransportedMap.put("A20220308000050","2022-03-09 19:38:33");
        waitTransportedMap.put("A20220308000037","2022-03-09 19:38:37");

        Map<String,String> result = new HashMap<>();

        for (Map.Entry<String, String> entry : clickMap.entrySet()) {
            String orderNo = entry.getKey();
            String transportedTime = waitTransportedMap.get(orderNo);
            result.put(orderNo,entry.getValue()+"::::"+transportedTime);
        }
        for (Map.Entry<String, String> stringEntry : result.entrySet()) {
            System.out.println(stringEntry.getKey() + "  " + stringEntry.getValue());
        }
    }
}